package com.twu.biblioteca.menu;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class MenuInputReader {
    private final BufferedReader br;

    public MenuInputReader()
    {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    public int readNumber() throws IOException, InvalidOptionException {
        int input;
        try
        {
            input = Integer.parseInt(br.readLine());
        }
        catch(NumberFormatException nfe)
        {
           throw new InvalidOptionException();
        }
        return input;
    }

    public String readString() throws IOException
    {
        return br.readLine();
    }
}
